#pragma once

#include "BasicCodeHighlighter.hpp"
#include "ErrorModel.hpp"




namespace Engine
{
	namespace Edit
	{
		class CssHighlighter
			: public BasicCodeHighlighter
		{
		public:

			SHARED(CssHighlighter);

			enum Type
			{
				Class,
				Attribute,
				State,
			};

			CssHighlighter(QTextDocument* parent, ErrorModel::const_ptr errors);
			virtual ~CssHighlighter();

		private:

			/**
			 * @returns the formatting rules for the given type of element
			 */
			QTextCharFormat format(Type type) const;

			/**
			 * Adds the given list of keywords to the highlighting rules.
			 *
			 * @param keywords   the keywords to add
			 * @param type       the type of keywords (determines formatting)
			 */
			void add(QStringList keywords, Type type);

		private:

			ErrorModel::const_ptr       m_errors;

			QTextCharFormat             m_normalFormat;
			QTextCharFormat             m_attributeFormat;
			QTextCharFormat             m_classFormat;
			QTextCharFormat             m_stateFormat;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
